package com.mg.smarttask.client;

import java.util.Date;

import com.google.gwt.user.client.rpc.IsSerializable;

public class Note implements IsSerializable{
	private static final long serialVersionUID = 1L;
	//champs
	private String description;
	private String title;
	private boolean isShared = false;
	private boolean isDone = false;
	private Date creationDate = new Date();
	private Date modificationDate;
	private long ownerId = 1;
	private long noteId = 0L;
	public Note(){
		modificationDate = this.creationDate;
	}
	public Note(String title,String description, boolean isShared, boolean isDone){
		this.title = title;
		this.description = description;
		this.isDone = isDone;
		this.isShared = isShared;
		modificationDate = this.creationDate;
	}
	
	public Note(String title,String description, boolean isShared, boolean isDone,
			Date creationDate,Date modificationDate){
		this.title = title;
		this.description = description;
		this.isDone = isDone;
		this.isShared = isShared;
		this.creationDate = creationDate;
		this.modificationDate = modificationDate;
	}
	
	public Note(String title,String description, boolean isShared, boolean isDone,
			Date creationDate,Date modificationDate, long ownerId){
		this.title = title;
		this.description = description;
		this.isDone = isDone;
		this.isShared = isShared;
		this.creationDate = creationDate;
		this.modificationDate = modificationDate;
		this.ownerId = ownerId;
	}
	
	
	//getters and Setters
	public String getDescription(){
		return description;
	}
	public String getTitle(){
		return title;
	}
	public boolean getIsShared(){
		return isShared;
	}
	public boolean getIsDone(){
		return isDone;
	}
	public void setDescription(String description){
		this.description = description;
	}
	public void setTitle(String title){
		this.title = title;
	}
	public void setIsShared(boolean isShared){
		this.isShared = isShared;
	}
	public void setIsDone(boolean isDone){
		this.isDone = isDone;
	}
	public void setCreationDate(Date creationDate){
		this.creationDate = creationDate;
	}
	public Date getCreationDate(){
		return creationDate;
	}
	public Date getModificationDate(){
		return modificationDate;
	}
	public void setModificationDate(Date modificationDate){
		this.modificationDate = modificationDate;
	}
	public long getOwnerId(){
		return ownerId;
	}
	public void setOwnerId(long ownerId){
		this.ownerId = ownerId;
	}
	public void setNoteId(long noteId){
		this.noteId = noteId;
	}
	public long getNoteId(){
		return noteId;
	}
	@Override
	public boolean equals(Object obj) {
		//check for self-comparison
	    if (this == obj) return true;
	    if ( !(obj instanceof Note) ) return false;
	    Note other = (Note) obj;	    
	    return other.getDescription().equals(description);
	}

}

